package com.xuxingcan.findmyvoice.Model;

import android.graphics.Bitmap;

import com.avos.avoscloud.AVFile;
import com.avos.avoscloud.AVObject;

import java.io.File;
import java.util.ArrayList;
import java.util.Date;

/**
 * Created by xuxingcan on 16-3-30.
 */
public class MessageModel {
    private String content;
    private ArrayList<Bitmap> bitmaps;
    private ArrayList<String> bitmapUrls;
    private String audioFile;
    private AVFile audioAvFile;
    private int audioTime;
    private Date creatDate;
    private String head;

    public MessageModel() {
    }

    public MessageModel(AVObject mAvObject) {
        AVObject msg = mAvObject.getAVObject("message");
        content = msg.getString("content");
        for (int i = 0; i < 3; i++) {
            if (msg.getAVFile("pic_" + i) != null)
                bitmapUrls.add(msg.getAVFile("pic_" + i).getUrl());
        }
        audioFile = msg.getAVFile("audio").getUrl();
        audioTime = (int) msg.getAVFile("audio").getMetaData("playTime");
        creatDate = msg.getCreatedAt();
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public ArrayList<Bitmap> getBitmaps() {
        return bitmaps;
    }

    public void setBitmaps(ArrayList<Bitmap> bitmaps) {
        this.bitmaps = bitmaps;
    }


    public int getAudioTime() {
        return audioTime;
    }

    public void setAudioTime(int audioTime) {
        this.audioTime = audioTime;
    }

    public Date getCreatDate() {
        return creatDate;
    }

    public void setCreatDate(Date creatDate) {
        this.creatDate = creatDate;
    }

    public ArrayList<String> getBitmapUrls() {
        return bitmapUrls;
    }

    public void setBitmapUrls(ArrayList<String> bitmapUrls) {
        this.bitmapUrls = bitmapUrls;
    }

    public String getAudioFile() {
        return audioFile;
    }

    public void setAudioFile(String audioFile) {
        this.audioFile = audioFile;
    }

    public String getHead() {
        return head;
    }

    public void setHead(String head) {
        this.head = head;
    }

    public AVFile getAudioAvFile() {
        return audioAvFile;
    }

    public void setAudioAvFile(AVFile audioAvFile) {
        this.audioAvFile = audioAvFile;
    }
}
